package com.appleyk.controller;

import com.appleyk.model.Message;
import com.appleyk.model.Result;
import org.springframework.web.bind.annotation.*;

import com.appleyk.service.QuestionService;

import javax.annotation.Resource;

@RestController
@RequestMapping("/rest/appleyk/question")
public class QuestionController {

    @Resource
    QuestionService questService;

    @PostMapping("/query")
    @CrossOrigin
    public Result<String> query(@RequestBody Message message) throws Exception {
        System.out.println("query: "+message.getQuestion());
        return Result.ok(questService.answer(message.getQuestion()));
    }

}
